#ifndef __FLICKR_H__
#define __FLICKR_H__

#include <QString>
#include <QByteArray>
#include <QBuffer>
#include <QHttp>
#include <QHttpResponseHeader>

class Flickr: public QObject
{
	Q_OBJECT
	
	public:
		Flickr();
		~Flickr();
		void GetFrob(const QString &user, const QString &pass);
		
		void GetLogin();
		int ParseFrob(QBuffer &frob, QString &strFrob);
		QString String2Md5( const QString& RequestString);
		QString BuildSignature(const QString& secret, const QMap<QString, QString>& map);
		void GetToken(QBuffer& buffer);
		void AddPhoto();
		
	private:
		QHttp *qhttp;
		QHttpResponseHeader CurrentResponseHeader;
		int httpGetFrobId;
		int httpGetTokenId;
		
		QString frob;

		QString perms		  ; // Permisions (read, write, delete)
		
		QString flickr_host;
		QString flickr_auth_path;
		QString flickr_rest_path;
		QString api_key;
		QString shared_secret;
		
		
		QBuffer Frob;

	
	private slots:
		void readResponseHeader(const QHttpResponseHeader &responseHeader);
		void slGotFrob(int requestId, bool error);
		void slGotToken(int requestId, bool error);
};

#endif

